class ResponseResult {
  int code;
  String msg;
  dynamic data;
  dynamic extraInfo;
  ResponseResult({this.code, this.msg, this.data,this.extraInfo});

  ResponseResult.success(data, {this.msg = ""})
      : this.data = data,
        this.code = 0;

  ResponseResult.failure({this.msg = ""}) : this.code = 1;

  factory ResponseResult.fromJson(Map<String, dynamic> json) {
    return ResponseResult(
      code: json['code'],
      msg: json['msg'],
      data: json['data'],
      extraInfo: json['extraInfo']
    );
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['code'] = this.code;
    data['msg'] = this.msg;
    data['data'] = this.data;
    return data;
  }
}
